Skip to content

Bug fix: allow local builds without requiring client directory #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

liorsve
Copy link
Contributor

@liorsve liorsve commented Apr 22, 2025

Description

Currently building the zola site locally is not possible when the clients directory is not built, as the zola serve command fails.
This is fixed by introducing an additional boolean variable clients_built in the client's page frontmatter, which is set to false by default, but updates to be true when running the init_topics_and_clients.sh script successfully. The page loads only if this var is set to true, otherwise a "Clients page not found" message is displayed, similar to the behavior in the commands and topics documentation.

Issues Resolved

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License.

Copy link
Member

@stockholmux stockholmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I can't get this to work as written.

If I change the value of clients_built to false then it does indeed not need the clients to build successfully (yay!) but if then try to run ./build/init-topics-and-clients.sh ../valkey-doc/topics ../valkey-doc/clients I get sed: 1: "content/clients/_index.md": command c expects \ followed by text and it doesn't flip the front matter boolean.

@@ -2,6 +2,7 @@
title = "Client Libraries"
template = "client-list.html"
[extra]
clients_built = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be set to false initially?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sorry about that — must’ve been left over from an earlier iteration when I was testing it

@liorsve
Copy link
Contributor Author

liorsve commented Jun 11, 2025

@stockholmux did you run it on macOS? I’ve updated the sed command so it works on both Linux and macOS now, in case that was the issue

@stockholmux
Copy link
Member

@stockholmux did you run it on macOS? I’ve updated the sed command so it works on both Linux and macOS now, in case that was the issue

Yep. I was testing on macOS. Any other flavours of sed we need to worry about?

The other thought that comes to mind now is if we're going to have constant problems with people accidentally committing clients_built = trueto content/clients/_index.md

@stockholmux
Copy link
Member

Okay! I played around with this and I think I found a way around sed and altering the frontmatter of files.

The problem here stems from load_data missing required= false - here is the Zola docs page

If you put required= false on the load_data in client-feature-table.html and client-list.html and check for the existence of object you set (e.g. {% set json_data ... followed by enclosing any use of json_data in {% if json_data %} ... {% endif %}`) we can avoid all this complexity. No sed! No frontmatter accidental commit issues!

@liorsve
Copy link
Contributor Author

liorsve commented Jun 12, 2025

So, I enclosed all of the content of this page with a check at the beginning - trying to use load_data with the first client's path and with required = false, and if it doesn't exist displaying the page not found message. That's because if I just updated the existing load data calls with required = false, the page would still start rendering the content from before that check. It works for me locally without the extra changes to the other load_data calls

Copy link
Member

@stockholmux stockholmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@stockholmux stockholmux merged commit 2b956fa into valkey-io:main Jun 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants